package chain

import (
	"fmt"
	"gowork/blockChain/block"
)

type Node struct {
	NextNode *Node
	Data  *block.Block
}

func GreateHeaderNode(data *block.Block) *Node {
	headerNode := new(Node)
	headerNode.NextNode = nil
	headerNode.Data = data

	return headerNode
}

func AddNote(data *block.Block, node *Node) *Node {
	var newNode *Node = new(Node)
	newNode.NextNode = nil
	newNode.Data = data

	node.NextNode = newNode

	return newNode
}

func ShowNodes(node *Node) {
	n := node
	for{
		if n.NextNode == nil{
			fmt.Println(n.Data)
			break
		}else{
			fmt.Println(n.Data)
			n = n.NextNode
		}
	}
}